from module_admin.entity.do.demo_do import Demo
from sqlalchemy.ext.asyncio import AsyncSession

from module_admin.entity.vo.demo_vo import DemoModel


class DemoDao:
    """
    DemoDao"""

    @classmethod
    async def add_demo_dao(cls, db: AsyncSession, demo: DemoModel):
        """
        添加Demo
        """
        db_demo = Demo(**demo.model_dump())
        db.add(db_demo)
        await db.flush()
        # await db.commit()
        return db_demo
